
using DataAccess;
using System;
using System.Collections.Generic;
using System.Data;
using System.Linq;
using System.Web;
using System.Web.UI;
using System.Web.UI.WebControls;
namespace KhoaLuan.MainSys.Manager.Controls
{
    public partial class ctManagementLog : System.Web.UI.UserControl
    {
        protected void Page_Load(object sender, EventArgs e)
        {
            if (!IsPostBack)
            {
                Session["folder"] = ""; show_tbLog();
            }
        }
        tbLog_Proxy pr = new tbLog_Proxy();
        void show_tbLog()
        {
            List<tbLog> dt = new List<tbLog>();
            dt = pr.SelectAlltbLog_Proxy();
            //this.grd_showtbLog.DataSource = dt;
            //this.grd_showtbLog.DataBind();
            dt.Clear();
            dt = null;
        }
        protected void grd_showtbLog_PageIndexChanged(object source, DataGridPageChangedEventArgs e)
        {
            // grd_showtbLog.CurrentPageIndex = e.NewPageIndex;
            // show_tbLog();}protected void grd_showtbLog_ItemCommand(object source, DataGridCommandEventArgs e)
            // { grd_showtbLog.EditItemIndex = (int)e.Item.ItemIndex;int a=grd_showtbLog.EditItemIndex;
            // this.txtId.Text = e.CommandArgument.ToString(); switch (e.CommandName.Trim().ToString()){
            // case "Edit":
            //{
            // List<tbLog> dt = new List<tbLog> ();
            // dt = pr.SelectAlltbLog_Proxy();
            // if (dt.Count > 0){
            //this.txtId.Text = dt[a].Id.ToString(); }
            //this.txtDate.Text = dt[a].Date.ToString(); }
            //this.txtThread.Text = dt[a].Thread.ToString(); }
            //this.txtLevel.Text = dt[a].Level.ToString(); }
            //this.txtLogger.Text = dt[a].Logger.ToString(); }
            //this.txtMessage.Text = dt[a].Message.ToString(); }
            // this.pn_showtbLog.Visible = false;
            // this.pn_updatetbLog.Visible = true; 
            //}
            // break;
            // case "Delete":
            // {
            // DataTable dt = new DataTable();
            // dt = pr.SelectAll_tbLog_Proxy();
            // int vt = 0;
            // vt = grd_showtbLog.EditItemIndex;
            // this.txtId.Text = dt.Rows[vt]["Id"].ToString();
            // pr.Delete_tbLog_Proxy(int.Parse(this.txtId.Text.ToString()));
            // show_tbLog(); 
            //}
            // break;
            // default:
            //break;
            // }
        }
        protected void lbtinserttbLog_Click(object sender, EventArgs e)
        {
            //this.txtId.Text = "";
            //this.txtThread.Text = "";
            //this.txtLevel.Text = "";
            //this.txtLogger.Text = "";
            //this.txtMessage.Text = "";
            //this.pn_showtbLog.Visible = false;
            //this.pn_updatetbLog.Visible = true;
        }
        protected void LinkButton1_Click(object sender, EventArgs e)
        {
            //this.pn_showtbLog.Visible = true;
            //this.pn_updatetbLog.Visible = false;
        }
        protected void btnThem_Click(object sender, EventArgs e)
        {
            //this.pn_showtbLog.Visible = false;
            //this.pn_updatetbLog.Visible = true;
        }
        protected void LinkButton2_Click(object sender, EventArgs e)
        {
            //this.lblerror.Text = "";
            //if (this.txtThread.Text.Trim().Length < 1)
            //{
            //this.lblerror.Text = "Thread không được trống";
            // return;
            //}
            //if (this.txtLevel.Text.Trim().Length < 1)
            //{
            //this.lblerror.Text = "Level không được trống";
            // return;
            //}
            //if (this.txtLogger.Text.Trim().Length < 1)
            //{
            //this.lblerror.Text = "Logger không được trống";
            // return;
            //}
            //if (this.txtMessage.Text.Trim().Length < 1)
            //{
            //this.lblerror.Text = "Message không được trống";
            // return;
            //}
            //if (this.txtId.Text.Trim().Length < 1)
            // {

            //tbLog	 a = new 	tbLog();
            // a.Date=this.txtDate.Text.Trim();
            // a.Thread=this.txtThread.Text.Trim();
            // a.Level=this.txtLevel.Text.Trim();
            // a.Logger=this.txtLogger.Text.Trim();
            // a.Message=this.txtMessage.Text.Trim();
            // pr.Insert_tbLog_Proxy(a);
            // }
            //else
            // {

            //tbLog	 b = new 	tbLog();
            // b.Id=int.Parse(this.txtId.Text.Trim());
            // b.Date= this.txtDate.Text.Trim();
            // b.Thread= this.txtThread.Text.Trim();
            // b.Level= this.txtLevel.Text.Trim();
            // b.Logger= this.txtLogger.Text.Trim();
            // b.Message= this.txtMessage.Text.Trim();pr.Update_tbLog_Proxy(b); 
            //}
            //show_tbLog();
            //this.pn_updatetbLog.Visible = false;
            //this.pn_showtbLog.Visible = true;
            //this.txtId.Text = "";
        }
    }
}